package com.shangpintechnology.sci.jni;



public class HandOutCardNativeCall {

	
	private static HandOutCardNativeCall nativeCall;
	public static HandOutCardNativeCall singleton(){
		if(null==nativeCall ){
			nativeCall = new HandOutCardNativeCall();
		}
		return nativeCall;
	}
 public  boolean initCOM(){
	 return true;
 }
 public   boolean openCOM(){
	 return true;
 }
 public   boolean readEPC(){
	 return true;
 }
 public byte[] revEPC(){
	 ;
	return null;
 }
 public static void main(String[]args){
	 HandOutCardNativeCall nc = new HandOutCardNativeCall();
	 boolean iInit = nc.initCOM();
	 System.out.println(iInit);
	 boolean roOpen = nc.openCOM();
	 System.out.println(roOpen+"");
	 boolean roRead =nc.readEPC();
	 System.out.println(roRead+"");
	 
	 for(int i =0;i<10;i++){
	 readprint(nc);System.out.print(""+i+"");
	   roRead =nc.readEPC();
	 System.out.println(roRead+"");
	 try{
	 Thread.sleep(1000);
	}catch(Exception e){
	 System.out.println(e+"E..");
	}
	 } readprint(nc);
	
	}
	
public static void readprint(HandOutCardNativeCall nc){


byte[] roRev = nc.revEPC();
	 if(roRev==null){
	 System.out.println("rev==null");
	 }else{
		 System.out.print("EPC:[");
		printHexString(roRev);
		
		 System.out.println("]");
		 
	 }
 
}
public static void printHexString( byte[] b) { 
for (int i = 0; i < b.length; i++) { 
String hex = Integer.toHexString(b[i] & 0xFF); 
if (hex.length() == 1) { 
hex = '0' + hex; 
} 
System.out.print(hex.toUpperCase() ); 
} 

}
public static String getHexString(){
	return new String("0DB0FB63ABEEAFC1EC88851A");
}




}
